// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store/'

import Mint from 'mint-ui';
import 'mint-ui/lib/style.css';
Vue.use(Mint);

import './config/index'

Vue.config.productionTip = false


router.beforeEach((to,from,next) => {
    
    if(to.matched.some( m => m.meta.auth)){
        // 对路由进行验证
        if(store.state.login) { // 已经登陆
          if(store.state.pathUrl==to.path){
            store.state.transitionName='back'
          }else{
            store.state.pathUrl=from.path
            store.state.transitionName='go'
          }
          next()
        }else{
            store.state.loginbg=true //提示用户登录
          }
    }else{
      next()
    }
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  template: '<App/>',
  components: { App }
})
